﻿using Newtonsoft.Json;
using ShanNiang.Hosting.Enumerate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace ShanNiang.Hosting.Common
{
    /// <summary>
    /// 请求基类
    /// </summary>
    public abstract class RequestBase
    {
        [JsonIgnore]
        [System.Text.Json.Serialization.JsonInclude]
        public abstract ApiServer ApiServer { get; }
        /// <summary>
        /// 请求方法
        /// </summary>
        [JsonIgnore]
        [System.Text.Json.Serialization.JsonInclude]
        public abstract HttpMethod Method { get; }
        /// <summary>
        /// 需要令牌
        /// </summary>
        [JsonIgnore]
        [System.Text.Json.Serialization.JsonInclude]
        public abstract bool NeedToken { get; }
        /// <summary>
        /// 请求的地址
        /// </summary>
        [JsonIgnore]
        [System.Text.Json.Serialization.JsonInclude]
        protected abstract string RequestPath { get; }
        /// <summary>
        /// 获取请求地址
        /// </summary>
        /// <param name="server"></param>
        /// <returns></returns>
        public string GetUrl(string server)
        {
            return $"{server}{RequestPath}";
        }
    }
}
